package com.test;

import io.netty.util.concurrent.DefaultThreadFactory;

/**
 * @author wufagang
 * @description
 * @date 2022年07月09日 09:59
 */
public class DefaultThreadFactoryDemo {

    public static void main(String[] args) {
        new DefaultThreadFactoryDemo().aa();
    }

    public void aa(){
        DefaultThreadFactory defaultThreadFactory = new DefaultThreadFactory(getClass());
        for (int i = 0; i < 10; i++) {
            System.out.println(defaultThreadFactory.newThread(() -> {
                System.out.println("1111");
            }).getName());
        }
        Thread thread = defaultThreadFactory.newThread(() -> {
            System.out.println("1111");
        });
        System.out.println(thread.getName());

        DefaultThreadFactory defaultThreadFactory2 = new DefaultThreadFactory(getClass());
        for (int i = 0; i < 10; i++) {
            System.out.println(defaultThreadFactory2.newThread(() -> {
                System.out.println("1111");
            }).getName());
        }

    }
}
